
// <copyright file="Employee.cs" company="Subhadra Software Solutions">
//   
// </copyright>
// <summary>
//   Class Employee.
// </summary>

namespace SubhadraSolutions.Sharp.Utils.Tests.DummyClasses
{
    using System;
    using System.Text;

    using SubhadraSolutions.Sharp.Utils.Reflection;

    /// <summary>
    ///     Class Employee.
    /// </summary>
    [Serializable]
    public class Employee
    {
        #region Public Properties

        /// <summary>
        ///     Gets or sets the date of birth.
        /// </summary>
        /// <value>The date of birth.</value>
        [PropertyOrder(1)]
        public DateTime DateOfBirth { get; set; }

        /// <summary>
        ///     Gets or sets the date of join.
        /// </summary>
        /// <value>The date of join.</value>
        [PropertyOrder(2)]
        public DateTime DateOfJoin { get; set; }

        /// <summary>
        ///     Gets or sets the type of the employment.
        /// </summary>
        /// <value>The type of the employment.</value>
        [PropertyOrder(3)]
        public EmploymentType EmploymentType { get; set; }

        /// <summary>
        ///     Gets or sets the first name.
        /// </summary>
        /// <value>The first name.</value>
        [PropertyOrder(4)]
        public string FirstName { get; set; }

        /// <summary>
        ///     Gets or sets the unique identifier.
        /// </summary>
        /// <value>The unique identifier.</value>
        [PropertyOrder(5)]
        public int Id { get; set; }

        /// <summary>
        ///     Gets or sets the last name.
        /// </summary>
        /// <value>The last name.</value>
        [PropertyOrder(6)]
        public string LastName { get; set; }

        #endregion Public Properties

        #region Public Methods and Operators

        /// <summary>
        ///     Builds the dummy employee.
        /// </summary>
        /// <returns>Employee.</returns>
        public static Employee BuildDummyEmployee()
        {
            var e = new Employee { Id = 0, FirstName = "SubhadraSolutionsmanya", LastName = "Oruganti", DateOfBirth = new DateTime(1979, 5, 1), DateOfJoin = new DateTime(2013, 10, 24), EmploymentType = EmploymentType.FullTime };
            return e;
        }

        /// <summary>
        /// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
        /// </summary>
        /// <param name="obj">
        /// The object to compare with the current object.
        /// </param>
        /// <returns>
        /// <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return false;
            }

            if (ReferenceEquals(this, obj))
            {
                return true;
            }

            var e = obj as Employee;
            if (e == null)
            {
                return false;
            }

            return this.DateOfBirth == e.DateOfBirth && this.DateOfJoin == e.DateOfJoin && this.EmploymentType == e.EmploymentType && this.FirstName == e.FirstName && this.Id == e.Id && this.LastName == e.LastName;
        }

        /// <summary>
        ///     Returns a hash code for this instance.
        /// </summary>
        /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns>
        public override int GetHashCode()
        {
            return this.ToString().GetHashCode();
        }

        /// <summary>
        ///     Returns a <see cref="System.String" /> that represents this instance.
        /// </summary>
        /// <returns>A <see cref="System.String" /> that represents this instance.</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();
            sb.Append("DateOfBirth = " + this.DateOfBirth + ",");
            sb.Append("DateOfJoin = " + this.DateOfJoin + ",");
            sb.Append("EmploymentType = " + this.EmploymentType + ",");
            sb.Append("FirstName = " + this.FirstName + ",");
            sb.Append("Id = " + this.Id + ",");
            sb.Append("LastName = " + this.LastName);
            return sb.ToString();
        }

        #endregion Public Methods and Operators
    }
}
